package com.example.travelplan.app;

import android.app.Activity;
import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;
import android.widget.TextView;

import static com.example.travelplan.app.R.*;


public class tabvisualizarActivity extends ActivityGroup {

   private  TabHost tabHost;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(layout.activity_tabvisualizar);

        tabHost = (TabHost)findViewById(id.tabHostTeste);

        tabHost.setup(getLocalActivityManager());

        TabHost.TabSpec tab1, tab2, tab3;
        Intent intent;

        intent = new Intent().setClass(this, tabListAtualActivity.class);
        tab1 = tabHost.newTabSpec("1").setIndicator("")
                .setContent(intent);
        TextView txVAtual = new TextView(this);
        txVAtual.append("Atual");
        txVAtual.setTextColor(color.preto);
        txVAtual.setGravity(Gravity.CENTER);
        txVAtual.setHeight(100);
        tab1.setIndicator(txVAtual);

        intent = new Intent().setClass(this, tabListHistoricoActivity.class);
        tab2 = tabHost.newTabSpec("2").setIndicator("")
                .setContent(intent);
        TextView txVHistórico = new TextView(this);
        txVHistórico.append("Histórico");
        txVHistórico.setTextColor(color.preto);
        txVHistórico.setGravity(Gravity.CENTER);
        txVHistórico.setHeight(100);
        tab2.setIndicator(txVHistórico);

        intent = new Intent().setClass(this, tabListFavoritosActivity.class);
        tab3 = tabHost.newTabSpec("3").setIndicator("")
                .setContent(intent);
        TextView txVFavoritos = new TextView(this);
        txVFavoritos.append("Favoritos");
        txVFavoritos.setTextColor(color.preto);
        txVFavoritos.setGravity(Gravity.CENTER);
        txVFavoritos.setHeight(100);
        tab3.setIndicator(txVFavoritos);

        tabHost.addTab(tab1);
        tabHost.addTab(tab2);
        tabHost.addTab(tab3);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.tabvisualizar, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

}
